package demo3;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-10-11
 * Time: 21:01
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        Queue<Integer> queueA = new LinkedList<>();
        Queue<Integer> queueB = new LinkedList<>();
        for (int i = 0; i < n; i++) {
            int x = scanner.nextInt();
            if(x % 2 == 0) {
                queueB.offer(x);
            } else {
                queueA.offer(x);
            }
        }
        int count = 0;
        int flag = 0;
        while(!queueA.isEmpty() && !queueB.isEmpty()) {
            if(count < 2) {
                if(flag == 0) {
                    System.out.print(queueA.poll());
                    flag++;
                } else {
                    System.out.print(" " + queueA.poll());
                }
            } else {
                if(flag == 0) {
                    System.out.print(queueB.poll());
                    flag++;
                } else {
                    System.out.print(" " + queueB.poll());
                }
                count = 0;
                continue;
            }
            count++;
        }
        while (!queueA.isEmpty()) {
            if (flag == 0) {
                System.out.print(queueA.poll());
                flag++;
            } else {
                System.out.print(" " + queueA.poll());
            }
        }
        while (!queueB.isEmpty()) {
            if (flag == 0) {
                System.out.print(queueB.poll());
                flag++;
            } else {
                System.out.print(" " + queueB.poll());
            }
        }
    }
}
